package com;

import java.util.ArrayList;
import java.util.List;

import lombok.Data;

public class TestListForEach {

	public static void main(String[] args) {
		List<EachModel> models = new ArrayList<>();
		for(int i=0;i<4;i++) {
			EachModel one = new EachModel();
			one.setCode(i + "-code");
			one.setName(i + "-name");
			models.add(one);
		}
		System.out.println(models);
		
		models.forEach(o -> {
			o.setCode("A-code");
		});
		
		System.out.println(models);

	}

	@Data
	static class EachModel {
		private String code;
		private String name;
	}

}
